//
//  DanGaoView.m
//  GuoBang
//
//  Created by fengshuai on 16/5/3.
//  Copyright © 2016年 梧桐树. All rights reserved.
//

#import "DanGaoView.h"

@implementation DanGaoView


-(instancetype)initWithFrame:(CGRect)frame
{
    
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        self.imageV = [[UIImageView alloc] initWithFrame:CGRectMake(11, 10, 60, 60)];
        [self addSubview:self.imageV];
        
        self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.imageV.frame) + 10, 7, 70, 14)];
        self.titleLabel.font = [UIFont systemFontOfSize:14];
        self.titleLabel.textColor = RGBCOLOR(46, 46, 46);
        [self addSubview:self.titleLabel];
        
        
        self.detailsLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMinX(self.titleLabel.frame), CGRectGetMaxY(self.titleLabel.frame) + 7, 200, 14)];
        
        self.detailsLabel.font = [UIFont systemFontOfSize:14];
        self.detailsLabel.textColor = RGBCOLOR(69, 69, 69);
        [self addSubview:self.detailsLabel];
        
        self.peiFangLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMinX(self.titleLabel.frame), CGRectGetMaxY(self.detailsLabel.frame) + 7, 40, 14)];
        self.peiFangLabel.text = @"配料: ";
        self.peiFangLabel.font = [UIFont systemFontOfSize:14];
        self.peiFangLabel.textColor = RGBCOLOR(69, 69, 69);
        [self addSubview:self.peiFangLabel];
        
        self.peiDetailsLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.peiFangLabel.frame) + 5, CGRectGetMaxY(self.detailsLabel.frame) + 7, 200, 14)];
        
        self.peiDetailsLabel.font = [UIFont systemFontOfSize:14];
        self.peiDetailsLabel.textColor = RGBCOLOR(69, 69, 69);
        [self addSubview:self.peiDetailsLabel];
        
        
        self.priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.frame.size.width - 160, 30, 100, 14)];
        self.priceLabel.font = [UIFont systemFontOfSize:14];
        self.priceLabel.textColor = RGBCOLOR(255, 109, 109);
        self.priceLabel.textAlignment = NSTextAlignmentRight;
        [self addSubview:self.priceLabel];
        
        
        self.dingBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        self.dingBtn.frame = CGRectMake(self.frame.size.width - 60, 10, 60, 60);
        [self.dingBtn setImage:[UIImage imageNamed:@"order_ico_ding.png"] forState:UIControlStateNormal];
        
        [self.dingBtn addTarget:self action:@selector(dingAction:) forControlEvents:UIControlEventTouchUpInside];
        self.frame=CGRectMake(self.frame.origin.x, self.frame.origin.y, self.frame.size.width, _peiDetailsLabel.frame.size.height+_peiDetailsLabel.frame.origin.y+10);
        [self addSubview:self.dingBtn];
        
        
    }
    
    return self;
    
}


- (id)initWithFrame:(CGRect)frame withImage:(UIImage *)image title:(NSString *)title detailsTitle:(NSString *)detailsTitle peiliao:(NSString *)peiliao price:(NSString *)priceStr
{
    
    
    
    self = [self initWithFrame:frame];
    if (self) {
        
        self.titleLabel.text = title;
        self.detailsLabel.text = detailsTitle;
        self.imageV.image = image;
        self.priceLabel.text = priceStr;
        self.peiDetailsLabel.text = peiliao;
    }
    
    return self;
    
    
    
    
}



- (void)dingAction:(UIButton *)sender
{
    
    
    
    
    
    
    
}

















@end
